xen/arm: atomic: Rewrite write_atomic()
authorJulien Grall <jgrall@amazon.com>
Sat, 2 May 2020 15:39:58 +0000 (16:39 +0100)
committerJulien Grall <jgrall@amazon.com>
Mon, 11 May 2020 09:48:30 +0000 (10:48 +0100)
commit52ffcfb73997e43717fa05802acc4503483d2d71
tree68f1d6c3db42b7eae746b4e62315e5261ddae5cb
parent9efda0281b29ac8ac5793457b8f71e6ff35f898c
xen/arm: atomic: Rewrite write_atomic()

The current implementation of write_atomic has two issues:
    1) It cannot be used to write pointer value because the switch
    contains cast to other size than the size of the pointer.
    2) It will happily allow to write to a pointer to const.

Additionally, the Arm implementation is returning a value when the x86
implementation does not anymore. This was introduced in commit
2934148a0773 "x86: simplify a few macros / inline functions". There are
no users of the return value, so it is fine to drop it.

The switch is now moved in a static inline helper allowing the compiler
to prevent use of const pointer and also allow to write pointer value.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/include/asm-arm/atomic.h